// $codepro.audit.disable
package edu.gatech.oad.records;

import edu.gatech.oad.doctorsorder.LabOrder;
import junit.framework.TestCase;

public class LabResultsTest extends TestCase {

	/**
	 * Tests adding a LabResult to the PatientHistory
	 */
	public void testAddLabResults()
	{
		PatientHistory curHistory = new PatientHistory();
		LabOrder testOrder = new LabOrder("notes", "name", "location", 25);
		LabResults curResult = new LabResults("test results", testOrder);
		curHistory.addLabRecord(curResult);
		assertEquals(1, curHistory.getLabResults().size());
	}
	
	
	/**
	 * Tests editing a LabResult
	 */
	public void testEditLabResults()
	{
		LabOrder testOrder = new LabOrder("notes", "name", "location", 25);
		LabResults curResult = new LabResults("test results", testOrder);
		assertEquals("test results", curResult.getResults()); //check current results
		curResult.setResults("new test results");
		assertEquals("new test results", curResult.getResults()); //check updated results
	}
	
	/**
	 * Tests removing LabResults from the patients history
	 */
	public void testDeleteLabResults()
	{
		PatientHistory curHistory = new PatientHistory();
		LabOrder testOrder = new LabOrder("notes", "name", "location", 25);
		LabResults firstResult = new LabResults("test results 1", testOrder);
		LabResults secondResult = new LabResults("test results 2", testOrder);
		curHistory.addLabRecord(firstResult);
		curHistory.addLabRecord(secondResult);
		assertEquals(2, curHistory.getLabResults().size());//check that 2 LabResults are in the history
		curHistory.removeLabRecord(secondResult);
		assertEquals(firstResult, curHistory.getLabResults().get(0));
		assertEquals(1, curHistory.getLabResults().size());//size is 1 smaller
	}
}
